package adv2;

import java.util.*;

public class ClsTest2 {

	public static Object createObj(int type) {
		switch (type) {
		case 1:
			return new HashMap();
		case 2:
			return new ArrayList();
		case 3:
			return new HashSet();
		}
		return new ClsTest();
	}

	public static void main(String[] args) throws Exception {
		Class c = HashMap.class;
		Class c2 = Class.forName("java.util.HashMap");
		HashMap m = new HashMap();
		Class c3 = m.getClass();
		// c=c2=c3

		Object o = createObj(2);
		System.out.println("返回的是：");
		System.out.println(o.getClass().getName());
	}
}
